<?xml version="1.0" encoding="utf-8" ?>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<jsp:include page="/commonPart/htmlHeader1.jsp">
	<jsp:param name="title" value="登录-CommonWorld" />
</jsp:include>
<body>
<jsp:include page= "/commonPart/bodyHeader1.jsp" ></jsp:include>
<div id = "banner">
	<div class = "wp998">
		<a id = "logo" href = "${initParam.webRootUrl}">CommonWorld</a>
		<h1>会员系统</h1>
		<div class = "clear"></div>
	</div>
</div>

<style type = "text/css">

#userPage {
	width: 998px;
	border: 1px solid #ddd;
	margin: 0 auto;
 	padding: 10px 0px;
	color: #000;
}

#userPage #userForm {
	width: 650px;
	margin: 0 auto;
	font-size: 13pt;
}

#userPage #userForm h2 {
	font-size: 18pt;
	font-weight: normal;
	text-align: left;
	padding-bottom: 10px;
}

#userForm hr {
	height: 2px; 
	width: 650px; 
	border-width: 0; 
	background-color: #ddd; 
}

#userForm table {
	margin: 0 auto;
	margin-bottom: 20px;
}

#userPage form th {font-size: 11pt; text-align: right; padding: 10px;}
#userPage form td {vertical-align:middle; width: 310px;}
#userPage form input.TEXT {font-size: 16px; padding: 3px; border:1px solid #ccc;}
#userPage form input.TEXT:FOCUS {boder:1px solid #40AA53; outline: none;}

#userPage form input.submit {font-size: 14px; font-weight: bold; padding: 0 10px; height: 30px;}

</style>

<div id = "CW_Screen">
	<div id = "userPage">
		<form action="/user/userLogin" id = "userForm" method = "post">
			<h2>登录CommonWorld</h2><hr />
			<table cellpadding="0" cellspacing="0">
				<tr>
					<th style = "padding:0px">&nbsp;</th>
					<td>
						<span id = "errorMsg" style = "font-size: 14px; color: red; padding-top: 1px; display: none"> </span>
					</td>
				</tr>
				<tr>
					<th>邮箱: </th>
					<td>
						<input type = "text" name = "email" id = "f_email" class = "TEXT" placeholder = "昵称/邮箱" style = "width: 200px;"></input>
					</td>
				</tr>
					<th>登录密码: </th>
					<td>
						<input type = "password" name = "password" id = "f_pass" class = "TEXT" style = "width: 200px;"></input>
					</td>
				<tr>
				<tr>
					<th>&nbsp;</th>
					<td>
						<input type = "checkbox" name = "autoLogin" value = "autoLogin" checked /><span>下次自动登录 </span>
					</td>
				</tr>
				<tr>
					<th>&nbsp;</th>
					<td>
						<input type = "submit" id = "submit" class = "submit" value = "登录" />
					</td>
				</tr>
			</table>
		</form>
	</div>

	<div id = "footer">
	</div>
</div>
<script src = "/js/sha1.js"></script>
<script>
$('#f_email').focus();
var pwd = "";
$("#userForm").bind('form-pre-serialize', function(event, form, options, veto) {
	pwd = $('#f_pass').val();
	$('#f_pass').val(CryptoJS.SHA1($('#f_pass').val()));
});

$("#userForm").ajaxForm({
	beforeSubmit: function(a, f, o) {
		if ($('#f_email').val().length == 0) {
			$('#f_pass').val(pwd);
			$('#f_email').focus();
			$('#errorMsg').text("请输入登录的邮箱或者昵称");
			$('#errorMsg').show("fast");
			return false;
		}
		if (pwd.length == 0) {
			$('#f_pass').val(pwd);
			$('#f_pass').focus();
			$('#errorMsg').text("请输入登录密码");
			$('#errorMsg').show("fast");
			return false;
		}
	},
	success: function(text) {
		if (text.length > 0) {
			$('#f_pass').val(pwd);
			$('#f_email').focus();
			$('#errorMsg').hide();
			$('#errorMsg').text(text);
			$('#errorMsg').show("fast");
		} else {
			location.href = '${(empty param.goto_page) ? initParam.webRootUrl : param.goto_page}';
		}
	}
});

</script>
</body>
</html>